Learn how to use the Sequence Builder analytics feature to query user data for your project with a serverless Cloudflare Worker.
Access Settings
Add Service Account
+ Add Service Account
:Select Write Permission
Write
, click on + Add Service Account
, and select Confirm
:copy
the key and store it in a safe location, as you will not have access to this in the future from the Sequence Builder.Create Project
mkdir
, cd
into the project, and run pnpm init
to create a package.json
.'Hello World' Worker
wrangler
keyword as an alias in your local bash session.wrangler init
and accept one of the randomly generated project folder names provided that you like, and follow the prompts to initialize your git tracked typescript "Hello World" Worker
application.wrangler init
with the last 2 step answered as No
to decline git versioning and deployment.This will clone down a starter repository that can be used to deploy code to the cloud.wrangler dev
command in the project folder for
local testingcd
into the randomly generated project folder, and perform a wrangler deploy
command.This should print a URL, which you can enter in the browser the URL https://<app>.<account>.workers.dev
to view the Hello World!
result.Setup Config, Routes, & Mock functions
wrangler.toml
with the following variables, where DAYS
is the time period you’re looking at:Env
type with the variables in index.ts
:fetch
function with the following mocked function calls:Date Formatting
wrangler.toml
for the DAYS
variable:Daily Active Users
Daily Active Users
request by using the following function, that calls the Sequence Analytics API:Total Transactions Sent
Total Transactions Sent
:Included Spacing for Days of Zero Data
walletStats
data passed in:/dailyActiveUsers
& /totalTransactionsSent
) once you have redeployed with wrangler deploy
.
Dune Sign Up
Create Query
https://dune.com/<account>
and select the Create
button and New query
.Daily Active Users Query
Run
:New visualization
.Then, select Add visualization
after the default Bar chart
is selected from the dropdown (but feel free to customize this).Save
and add a name to your query.Total Transactions Sent Query
New visualization
.Then, select Add visualization
and scroll down to Counter
to create a counter widget that returns the absolute total returned from the API.Create New Dashboard
Create
> New dashboard
and input a name for the new dashboard.Edit
and Add visualization
.Add
for each query, then Done
in the modal, and Done
in the dashboard.Share
button.